<template>
  <div class="songsheet">
    <!-- 顶部 -->
    <div class="sos_top">
      <div class="st_img" :style="'background-image:url('+ songlist.coverImgUrl +')'"></div>
      <div class="st_word">
        <img :src="songlist.coverImgUrl" alt />
        <div class="stWordRigth">
          <p class="songName">{{ songlist.name }}</p>
          <p>
            <img :src="imgSrc" alt />
            {{ wordP }}
          </p>
        </div>

        <!-- <p class="songFrequency">{{ songlist.updateFrequency }}</p> -->
        <!-- <p class="songDescription">{{ songlist.description }}</p> -->
      </div>
    </div>
    <!-- 简介 -->
    <ul class="pylst_intro">
      <li>
        标签：
        <span v-for="(item,index) of songlist.tags" :key="index">{{ item }}</span>
      </li>
      <li>
        <span class="songDescription" v-html="'简介：'+description" :class= songDescriptionShow></span>
      </li>
      <li @click="Show">
        <i :class= iconClass ></i>
      </li>
    </ul>
    <p class="u-smtitle">歌曲列表</p>
    <div class="songlist">
      <div class="ht_creator" v-for="(song,inds) of songlist.tracks" :key="inds">
        <div class="num">{{inds+1>9?inds+1:'0'+(inds+1)}}</div>
        <div class="info">
          <div class="song">
            {{ song.name }}
            <span v-for="(songs,indes) of song.alia" :key="indes">({{ songs }})</span>
          </div>
          <div class="singer">
            <span v-for="(songer,i) of song.ar" :key="i">{{ songer.name }}</span>
            <span>- {{ song.al.name}}</span>
          </div>
        </div>
        <div class="icon">
          <span></span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { log } from 'util';
export default {
  data() {
    return {
      songlist: [],
      imgSrc: "",
      wordP: "",
      description: "",
      songDescriptionShow:'songDescriptionShow',
      iconClass:'el-icon-arrow-down',
      pageY:''
    };
  },
  methods: {
    getSonglist() {
      return this.$http.get("/playlist/detail?id=2738703582");
    },
    Show(e){
      if(this.songDescriptionShow == ''){
        this.songDescriptionShow = 'songDescriptionShow'
        this.iconClass = 'el-icon-arrow-down'
      }else {
        this.songDescriptionShow = ''
        this.iconClass = 'el-icon-arrow-up'
      }
     this.pageY =  e.pageY
     if(this.pageY <= e.pageY){
       
     }
    }
  },
  mounted() {
    let id = this.$route.params.id;
    this.$http.get("/api/playlist/detail?id=" + id).then(result => {
      this.songlist = result.data.playlist;
      this.description = this.songlist.description.replace(/\n/g, "<br />");
      this.imgSrc = this.songlist.creator.avatarUrl;
      this.wordP = this.songlist.creator.nickname;
    });
  }
};
</script>
<style>
.songsheet {
  height: 100%;
  background: #f8f8f8;
}
.sos_top {
  height: 3.5rem;
  position: relative;
  overflow: hidden;
}
/* 背景图 */
.st_img {
  height: 100%;
  width: 100%;
  background-position: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 30px 10px 30px 15px;
  box-sizing: border-box;
  filter: blur(20px);
  position: absolute;
  left: 0;
  top: 0;
}
/* 文字盒子 */
.st_word {
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  padding: 30px 10px 30px 15px;
  box-sizing: border-box;
  display: flex;
}
.stWordRigth {
  margin-left: 16px;
  float: left;
  flex: 1;
}

/* 文字盒子图片 */
.st_word > img {
  height: 100%;
  float: left;
}
/* 文字样式 */
.sos_top p {
  color: #fff;
  font-size: 0.3rem;
}
.songName {
  display: block;
  font-weight: 700;
  height: 0.85rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 0.85rem;
}
.stWordRigth p img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  float: left;
  margin-right: 5px;
}
.stWordRigth p:last-child {
  height: 30px;
  font-size: 0.25rem;
  color: #c0c2c5;
  margin-top: 20px;
  vertical-align: middle;
  line-height: 30px;
}
.pylst_intro {
  font-size: 14px;
  color: #666666;
  /* height: 1.18rem; */
  padding-top: 10px;
  margin: 0 10px 25px 15px;
  position: relative;
}
.pylst_intro li {
  margin-bottom: 10px;
}
.pylst_intro li:first-child span {
  border: 1px solid #ccc;
  border-radius: 15px;
  margin: 0 5px;
  padding: 2px 5px;
  font-size: 12px;
}
.pylst_intro li:last-child {
  margin: 0;
  position: absolute;
  right: 0;
  bottom: -20px;
  font-size: .3rem;
} 
.songDescription {
  /* height: 100px; */
  width: 100%;
  height: 55px;
  overflow: hidden;
  text-overflow: ellipsis;
  /* 形成webkt特有的伸缩盒 */

  /* 设置文本行数  weikit独有 */
  -webkit-line-clamp: 3;
  /* 设置文本的排列方式， 伸缩盒的特性 */
  -webkit-box-orient: vertical;
}
.songDescriptionShow{
    display: -webkit-box;
}
.u-smtitle {
  background: #eeeff0;
  font-size: 13px;
  height: 0.41rem;
  line-height: 0.41rem;
}
/* 列表样式 */
.ht_creator {
  display: flex;
  font-size: 0.28rem;
  padding: 10px;
}
.ht_creator .num {
  padding-right: 0.2rem;
  font-size: 0.28rem;
  margin-top: 5px;
}

.ht_creator:nth-child(-n + 3) .num {
  color: red;
}
.info {
  flex: 1;
  overflow: hidden;
}
.song {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.song span {
  color: rgb(124, 122, 122);
}
.singer {
  font-size: 0.22rem;
  color: rgb(124, 122, 122);
}
</style>